<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--{template /_install/view/meta}-->
</head>
<body>
	<!--{template /_install/view/head}-->

	<div class="install">
		<form action="install.php" method="post"
			onsubmit="javascript:return check_form(this);">
			<input type="hidden" name="formsubmit" value="yes" />

			<div class="box-mini input">
				<div class="left">
					<p class="head">目录权限</p>
					<p class="text">_cache、attachment、tpl及config.php/.htaccess赋予777权限</p>
					<hr size="1" color="#f7f7f7" />

					<p class="head">Apache、Nginx模块</p>
					<p class="text">.htaccess或rewrite功能</p>
					<hr size="1" color="#f7f7f7" />

					<p class="head">PHP组件</p>
					<ul>
						<li>curl{echo $extensions['curl'] ? '<span class="ok">√</span>'
							: '<span class="error">X</span>';}
						</li>
						<li>gd{echo $extensions['gd'] ? '<span class="ok">√</span>' :
							'<span class="error">X</span>';}
						</li>
						<li>mysql{echo $extensions['mysql'] ? '<span class="ok">√</span>'
							: '<span class="error">X</span>';}
						</li>
						<li>mbstring{echo $extensions['mbstring'] ? '<span class="ok">√</span>'
							: '<span class="error">X</span>';}
						</li>
						<br class="clear" />
					</ul>
					<hr size="1" color="#f7f7f7" />

					<p class="head">Mysql数据库</p>

					<table>
						<tr>
							<td class="label">域名：</td>
							<td><input type="text" name="txtHost" size="25"
								maxlength="30" placeholder="输入Host域名…"
								value="{echo $config['db'][1]['dbhost'] ? $config['db'][1]['dbhost'] : '127.0.0.1';}" />
								<span class="icon"></span></td>
						</tr>
						<tr>
							<td class="label">用户名：</td>
							<td><input type="text" name="txtUser" size="25"
								maxlength="30" placeholder="输入用户名…"
								value="{echo $config['db'][1]['dbuser'] ? $config['db'][1]['dbuser'] : 'root';}" />
								<span class="icon"></span></td>
						</tr>
						<tr>
							<td class="label">密码：</td>
							<td><input type="text" name="txtPassword" size="25"
								maxlength="30" placeholder="输入密码…"
								value="{echo $config['db'][1]['dbpw'] ? $config['db'][1]['dbpw'] : '';}" />
								<span class="icon"></span></td>
						</tr>
						<tr>
							<td class="label">数据库：</td>
							<td><input type="text" name="txtDatabase" size="25"
								maxlength="30" placeholder="输入数据库名称…"
								value="{echo $config['db'][1]['dbname'] ? $config['db'][1]['dbname'] : '';}" />
								<span class="icon"></span></td>
						</tr>
						<tr>
							<td class="label"></td>
							<td></td>
						</tr>
					</table>
					<hr size="1" color="#f7f7f7" />
					<table>
						<tr>
							<td class="label"></td>
							<td><br />
								<button type="submit" name="btnSubmit">确认提交</button></td>
						</tr>
					</table>
				</div>

				<div class="right" style="line-height: 20px;">
					<div class="protocal">
						<!--{if $config['crypt'] == '_EC2014010300'}-->
						<!--{template /_install/view/license_gpl}-->
						<!--{else}-->
						<!--{template /_install/view/license_business}-->
						<!--{/if}-->
					</div>

					<br />

					<p class="checkbox">
						<label> <input type="checkbox" name="cbxAgree"
							id="cbx_agree" value="1" checked="checked" /> 我已阅读协议，同意以上条款！
						</label>
					</p>
				</div>

				<br class="clear" />
			</div>
		</form>

		<script type="text/javascript">
		function check_form(frm){
			if(frm.txtHost.value.trim().length == 0){
				$.dialog({message:'域名不能为空！'});
				return false;
			}
			
			if(frm.txtUser.value.trim().length == 0){
				$.dialog({message:'用户名不能为空！'});
				return false;
			}
			
			if(frm.txtDatabase.value.trim().length == 0){
				$.dialog({message:'数据库名称不能为空！'});
				return false;
			}
			
			if(!frm.cbxAgree.checked){
				$.dialog({message:'请先阅读协议并同意条款！'});
				return false;
			}
			
			$.dialog({message:'组件及参数是否正确？', button:{cancel:'关闭', submit:'确认安装'}, callback:function(){
				$('#_dialog .operate .submit').removeClass('button-gray');
			},submit:function(){
				frm.submit();
			}});
			
			return false;
		}
		</script>
	</div>
</body>
</html>